import {createStore ,combineReducers} from 'redux'
import {Map} from 'immutable'
// import thunk from 'redux-thunk';

import shoppingcarReducer from './shoppingcar'
import productsReducer from './products'
// console.log(shoppingcarReducer,productsReducer)

// const AppReducer=combineReducers({
//     shoppingcar:shoppingcarReducer,
//     products:productsReducer
// })
function combineReducers_im(options) {
    return function (state = Map(), action) {
        let wrap = Map();
        for (let p in options) {
            if (options.hasOwnProperty(p)) {
                wrap = wrap.set(p, options[p](state.get(p), action))
            }
        }
        return wrap;
    }
}
const AppReducer=combineReducers_im({
    shoppingcar:shoppingcarReducer,
    products:productsReducer
})
export const store=createStore(AppReducer)
